package com.think.teaching.service;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface StatMapper {
	
	@Select("SELECT COUNT(student_id) FROM `course_user` WHERE course_id = #{id}; ")
	Integer GetCourseSelectUserCount(Integer id);
	
	@Select("SELECT COUNT(r.id) FROM user_exam_result r WHERE r.exam_id IN (SELECT t.id FROM exam_test t WHERE t.paper_id in (SELECT p.id FROM exam_paper p WHERE p.course_id = #{id})); ")
	Integer GetCourseExamUserCount(Integer id);
	
	@Select("SELECT COUNT(id) FROM action_data WHERE action_data.type_id = #{type} AND action_value='#{id}';")
	Integer GetCourseViewCount(Integer id,Integer type);
	
	@Select("SELECT COUNT(student_id) FROM `course_user` WHERE course_id = #{id}; ")
	Integer GetVRSelectUserCount(Integer id);
	
	@Select("SELECT COUNT(r.id) FROM user_exam_result r WHERE r.exam_id IN (SELECT t.id FROM exam_test t WHERE t.paper_id in (SELECT p.id FROM exam_paper p WHERE p.course_id = #{id})); ")
	Integer GetVRExpCount(Integer id);
	
	@Select("SELECT COUNT(id) FROM action_data WHERE action_data.type_id = #{type} AND action_value='#{id}';")
	Integer GetVRViewCount(Integer id,Integer type);
	
	@Select("SELECT COUNT(id) FROM action_data WHERE action_data.type_id = #{type} AND action_value='#{id}';")
	Integer GetVRReportCount(Integer id,Integer type);
}
